<template>
  <div class="moneyDetail">
    <div class="bt_box">
      <p class="btText">子商户进件基本资料</p>
    </div>
    <div class="information">
      <div class="list">
        <div class="lable">开通子账户支付公司:</div>
        <div class="text">{{data.typeDict}}</div>
      </div>
      <div class="list">
        <div class="lable">子商户编号:</div>
        <div class="text">{{data.merchantNo}}</div>
      </div>
      <div class="list">
        <div class="lable">子商户状态:</div>
        <div class="text">{{data.statusDict}}</div>
      </div>
      <div class="list">
        <div class="lable">子商户类型:</div>
        <div class="text">{{data.merchantTypeDict}}</div>
      </div>
      <div class="list">
        <div class="lable">公司账号名称:</div>
        <div class="text">{{data.signName}}</div>
      </div>
      <div class="list">
        <div class="lable">法人证件类型:</div>
        <div class="text">{{data.idTypeDict}}</div>
      </div>
      <div class="list">
        <div class="lable">法人名字:</div>
        <div class="text">{{data.legalPerson}}</div>
      </div>
      <div class="list">
        <div class="lable">支付展示名:</div>
        <div class="text">{{data.showName}}</div>
      </div>
      <div class="list">
        <div class="lable">法人身份证号:</div>
        <div class="text">{{data.legalPersonID}}</div>
      </div>
      <div class="list">
        <div class="lable">法人身份证开始日期:</div>
        <div class="text">{{data.idCardStartDate}}</div>
      </div>
      <div class="list">
        <div class="lable">法人身份证结束日期:</div>
        <div class="text" v-if="!data.idCardValidType">{{data.idCardEndDate}}</div>
        <div class="text" v-if="data.idCardValidType">长期有效</div>
      </div>
      <div class="list">
        <div class="lable">经营起始日期:</div>
        <div class="text">{{data.businessDateStart}}</div>
      </div>
      <div class="list">
        <div class="lable">经营期限:</div>
        <div class="text">{{data.businessDateLimit}}</div>
      </div>
      <div class="list">
        <div class="lable">组织机构代码:</div>
        <div class="text">{{data.orgNum}}</div>
      </div>
      <div class="list">
        <div class="lable">所在省份:</div>
        <div class="text">{{data.province}}</div>
      </div>
      <div class="list">
        <div class="lable">所在城市:</div>
        <div class="text">{{data.city}}</div>
      </div>
      <div class="list">
        <div class="lable">区县编码:</div>
        <div class="text">{{data.regionCode}}</div>
      </div>
      <div class="list">
        <div class="lable">营业执照号:</div>
        <div class="text">{{data.businessLicense}}</div>
      </div>
      
      <div class="list" style="align-items: flex-start">
        <div class="lable">通讯地址:</div>
        <div class="text">{{data.address}}</div>
      </div>
      <div class="list">
        <div class="lable">联系人:</div>
        <div class="text">{{data.linkman}}</div>
      </div>
      <div class="list">
        <div class="lable">联系人身份证:</div>
        <div class="text">{{data.linkManId}}</div>
      </div>
      <div class="list">
        <div class="lable">联系电话:</div>
        <div class="text">{{data.linkPhone}}</div>
      </div>
      <div class="list">
        <div class="lable">联系邮箱:</div>
        <div class="text">{{data.email}}</div>
      </div>
      <div class="list">
        <div class="lable">经营类别:</div>
        <div class="text">{{data.merchantCategoryDict}}</div>
      </div>
      <div class="list">
        <div class="lable">行业类型编码:</div>
        <div class="text">{{data.industryTypeCode}}</div>
      </div>
      <div class="list">
        <div class="lable">是否微信授权:</div>
        <div class="text">{{data.wxApplyStatusDict}}</div>
      </div>
      <div class="list">
        <div class="lable">是否完成电子签章:</div>
        <div class="text">{{data.signatureStatusDict}}</div>
      </div>
    </div>
    <div class="bt_box">
      <p class="btText">子商户进件基本资料</p>
      <el-button size="small" type="primary" @click="editSettlement">修改结算方式</el-button>
      <el-button size="small" type="primary" @click="editRate">修改费率</el-button>
    </div>
    <div class="information">
        <div class="list">
        <div class="lable">开户名:</div>
        <div class="text">{{data.accountName}}</div>
      </div>
      <div class="list">
        <div class="lable">开户账号:</div>
        <div class="text">{{data.accountNo}}</div>
      </div>
      <div class="list">
        <div class="lable">结算卡联行号:</div>
        <div class="text">{{data.bankCode}}</div>
      </div>
      <div class="list">
        <div class="lable">结算卡类型:</div>
        <div class="text">{{data.settleBankTypeDict}}</div>
      </div>
      <div class="list">
        <div class="lable">结算类型:</div>
        <div class="text">{{data.settlementPeriodDict}}</div>
      </div>
      <div class="list">
        <div class="lable">结算卡方式:</div>
        <div class="text">{{data.settlementModeDict}}</div>
      </div>
      <div class="list">
        <div class="lable">开通产品类型:</div>
        <div class="text">{{data.productTypeDict}}</div>
      </div>
      <div class="list">
        <div class="lable">开通客户端类型:</div>
        <div class="text">{{fileArr(data.appPayTypeDict)}}</div>
      </div>
      <div class="list">
        <div class="lable">支付类型:</div>
        <div class="text">{{fileArr(data.payTypeDict)}}</div>
      </div>
      <div class="list">
        <div class="lable">费率类型:</div>
        <div class="text">{{data.feePurposeDict}}</div>
      </div>
      <div class="list">
        <div class="lable">费率模式:</div>
        <div class="text" style="display:flex;justify-content: flex-start">{{data.appFeeModeDict}}<p class="look" v-if="data.appFeeMode == 'RANGE'" @click="lookDetail">查看</p></div>
        
      </div>
      <div class="list" v-if="data.appFeeMode == 'DEFAULT'">
        <div class="lable">费率:</div>
        <div class="text">{{data.feeValue}}</div>
        
      </div>
      <div class="list" v-if="data.appFeeMode == 'DEFAULT'">
        <div class="lable">最低费率金额（元）:</div>
        <div class="text">{{data.minFee}}</div>
      </div>
    </div>
    <div class="bt_box">
      <p class="btText">资质图片</p>
    </div>
    <div class="imgBox">
      <div class="imgList">
        <div class="lable">营业执照:</div>
        <img class="img" :src="credentials.businessLicense" alt="">
      </div>
      <div class="imgList">
        <div class="lable">开户许可证:</div>
        <img class="img" :src="credentials.permitForBankAccount" alt="">
      </div>
      <div class="imgList">
        <div class="lable">法人身份证正面:</div>
        <img class="img" :src="credentials.frontOfIdCard" alt="">
      </div>
      <div class="imgList">
        <div class="lable">法人身份证反面:</div>
        <img class="img" :src="credentials.backOfIdCard" alt="">
      </div>
      <div class="imgList">
        <div class="lable">门头照:</div>
        <img class="img" :src="credentials.singBoard" alt="">
      </div>
      <div class="imgList">
        <div class="lable">室内场景照:</div>
        <img class="img" :src="credentials.interiorPhoto" alt="">
      </div>
      <div class="imgList">
        <div class="lable">收银台照:</div>
        <img class="img" :src="credentials.checkoutCounter" alt="">
      </div>
      <div class="imgList" v-if="credentials.bankCard">
        <div class="lable">法人结算卡:</div>
        <img class="img" :src="credentials.bankCard" alt="">
      </div>
      <div class="imgList" v-if="credentials.bankCard">
        <div class="lable">结算人银行卡:</div>
        <img class="img" :src="credentials.bankCard" alt="">
      </div>
      <div class="imgList" v-if="credentials.authorizationForSettlement">
        <div class="lable">结算账户指定书:</div>
        <img class="img" :src="credentials.authorizationForSettlement" alt="">
      </div>
      <div class="imgList" v-if="credentials.settleFrontOfIdCard">
        <div class="lable">结算人身份证正面:</div>
        <img class="img" :src="credentials.settleFrontOfIdCard" alt="">
      </div>
      <div class="imgList" v-if="credentials.settleBackOfIdCard">
        <div class="lable">结算人身份证反面:</div>
        <img class="img" :src="credentials.settleBackOfIdCard" alt="">
      </div>
      <div class="imgList" v-if="credentials.handheldOfBankCard">
        <div class="lable">结算人手持结算卡:</div>
        <img class="img" :src="credentials.handheldOfBankCard" alt="">
      </div>
      <div class="imgList" v-if="credentials.handheldOfIdCard">
        <div class="lable">结算人手持身份证:</div>
        <img class="img" :src="credentials.handheldOfIdCard" alt="">
      </div>
    </div>
    <detail-dialog
			ref="childRef"
      v-if="detailDialog"
      :id="data.merchantNo"
      :visible.sync="detailDialog"
    />
  </div>
</template>
<script>
// components
import Loading from '@/components/Loading/index'
import DetailDialog from './moneyDetail/DetailDialog'

//api 
import {
 getDetail,
 getapplyqueryStatus,
 getqueryStatus
} from '@/api/moneyManagement'

export default {
  components: {
    Loading,
    DetailDialog
  },
  props: {
    visible: Boolean,
    id: String
  },
  data() {
    return {
      detailDialog: false,
			fundId: '',
			data: {},
      credentials:{},
    }
  },
  computed: {
   
  },
  created() {
    this.fundId = this.$route.query.fundId
    
    this.getDetail()
	},
  methods: {
    //第三步提交，查询结果
    getDetail(){
      const fundId = this.fundId
      console.log(fundId)
      getDetail(fundId).then(res => {
        const {  credentials } = res.result
        this.data = res.result
        this.credentials = credentials
      })
      .finally(() => {
        this.loading = false
      })
    },
    fileArr(data){
      if(data){
        if(data.length > 1){
        return data.join(',')
      }else if(data.length <= 1){
        return data[0]
      }
      }
      
      
    },
    
    //修改结算方式
    editSettlement(){
      const merchantNo = this.data.merchantNo
      getapplyqueryStatus(merchantNo).then(res => {
        const {  status } = res.result
        if(status != 2 && status != 7){
          this.$router.push({
            path: '/moneyManagement/edit-eettlement',
            query:{
              merchantNo: this.data.merchantNo,
              showName:this.data.showName
            },
          })
        }else{
          this.$message({
            message: '在审核中不能修改',
            type: 'warning',
            duration: 1500,
          })
        }
      })
      .finally(() => {
        this.loading = false
      })
      
    },
    
    //修改费率
    editRate(){
      const merchantNo = this.data.merchantNo
      getqueryStatus(merchantNo).then(res => {
        const {  status } = res.result
        if(status != 1){
          this.$router.push({
            path: '/moneyManagement/edit-rate',
            query:{
              merchantNo: this.data.merchantNo,
            },
          })
        }else{
          this.$message({
            message: '在审核中不能修改',
            type: 'warning',
            duration: 1500,
          })
        }
      })
    },
    //查看
    lookDetail(){
      this.detailDialog = true
    },
  }
}
</script>
<style lang="scss" scoped>
@import './style/moneyDetail';


</style>
